var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var BundleConfig = require("AA_BundleConfig");
var ResKeeper = require("AA_ResKeeper");
var CommonUtils = require("AA_CommonUtils");
var PlayerDataManager = require("AA_PlayerDataManager");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UI_QianDaoItem = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.qiandaoday = null;
    t.qiandaovalue = null;
    t.iconSpr = null;
    t.lockweilai = null;
    t.putonglinqu = null;
    t.linquLock = null;
    t.nowcode = 1;
    t.nowqiandao = null;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype.onEnable = function () { };
  _creator.prototype.onDisable = function () { };
  _creator.prototype.initUi = function (e) {
    return __awaiter(this, undefined, undefined, function () {
      var t;
      var o;
      var n;
      return __generator(this, function (i) {
        switch (i.label) {
          case 0:
            this.nowqiandao = e;
            this.qiandaoday.string = "第" + e.id + "天";
            this.qiandaovalue.string = e.award + "";
            t = null;
            switch (e.awardtype) {
              case 1:
                return [3, 1];
              case 2:
                return [3, 3];
              case 3:
                return [3, 5];
              case 5:
                return [3, 7];
              case 6:
                return [3, 9];
              case 7:
                return [3, 11];
            }
            return [3, 13];
          case 1:
            return [4, this._loadRes(BundleConfig.BundleNames.Common, "common/" + "res/ui/tu/goldIcon", cc.SpriteFrame)];
          case 2:
            t = i.sent();
            this.iconSpr.spriteFrame = t;
            return [3, 13];
          case 3:
            return [4, this._loadRes(BundleConfig.BundleNames.Common, "common/" + "res/ui/tu/diamondIcon", cc.SpriteFrame)];
          case 4:
            t = i.sent();
            this.iconSpr.spriteFrame = t;
            return [3, 13];
          case 5:
            return [4, this._loadRes(BundleConfig.BundleNames.Common, "common/" + "res/ui/tu/powerIcon", cc.SpriteFrame)];
          case 6:
            t = i.sent();
            this.iconSpr.spriteFrame = t;
            return [3, 13];
          case 7:
            return [4, this._loadRes(BundleConfig.BundleNames.Common, "common/" + "res/quality/suipian_1", cc.SpriteFrame)];
          case 8:
            t = i.sent();
            this.iconSpr.spriteFrame = t;
            return [3, 13];
          case 9:
            return [4, this._loadRes(BundleConfig.BundleNames.Common, "common/" + "res/quality/suipian_2", cc.SpriteFrame)];
          case 10:
            t = i.sent();
            this.iconSpr.spriteFrame = t;
            return [3, 13];
          case 11:
            return [4, this._loadRes(BundleConfig.BundleNames.Common, "common/" + "res/quality/suipian_3", cc.SpriteFrame)];
          case 12:
            t = i.sent();
            this.iconSpr.spriteFrame = t;
            return [3, 13];
          case 13:
            CommonUtils.default.LimitSpriteMaxSize(this.iconSpr, 80);
            o = PlayerDataManager.PlayerDataMgr.getQianDaoCount();
            n = e.id - 1;
            if (o > n) {
              this.linquLock.active = true;
              this.lockweilai.active = true;
              this.putonglinqu.active = false;
              this.nowcode = -1;
            }
            if (o == n) {
              if (1 == PlayerDataManager.PlayerDataMgr.globalData.isqiandaocode) {
                this.linquLock.active = false;
                this.lockweilai.active = false;
                this.putonglinqu.active = true;
                this.nowcode = 1;
              } else {
                this.linquLock.active = false;
                this.lockweilai.active = true;
                this.putonglinqu.active = false;
                this.nowcode = 2;
              }
            }
            if (o < n) {
              this.linquLock.active = false;
              this.lockweilai.active = true;
              this.putonglinqu.active = false;
              this.nowcode = 2;
            }
            return [2];
        }
      });
    });
  };
  __decorate([_property(cc.Label)], _creator.prototype, "qiandaoday", undefined);
  __decorate([_property(cc.Label)], _creator.prototype, "qiandaovalue", undefined);
  __decorate([_property(cc.Sprite)], _creator.prototype, "iconSpr", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "lockweilai", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "putonglinqu", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "linquLock", undefined);
  return __decorate([_ccclass], _creator);
}(ResKeeper.default);
exports.default = _def_UI_QianDaoItem;